import React, { useEffect } from 'react';
import './App.css';
import {connect, useSelector} from 'react-redux';
function App() {

  const {incomingMessage,loading}=useSelector(state=>{
    console.log('select');
    return state
  })
  
  const messages = incomingMessage.map(message => {
          return (
            <li key={message.id}>{message.title}</li>
          )
        })
  return (
    <div className="App">
      {loading?<span>loading</span>:messages}
      </div>
  );
}


export default App;
